package org.smarthings.things.automation.test.mock;

import com.espertech.esper.client.EPServiceProvider;
import com.espertech.esper.client.EPStatement;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.client.StatementAwareUpdateListener;

public class MockedStatementAwareUpdateListener implements StatementAwareUpdateListener {

	public MockedStatementAwareUpdateListener() {

	}

	public void update(EventBean[] newEvents, EventBean[] oldEvents, EPStatement statement,
			EPServiceProvider eventProcessingService) {

		System.out.println(">>>>> BasicStatementAwareUpdateListener.update()");
		if (newEvents != null) {
			System.out.println("-- new events:");
			for (int i = 0; i < newEvents.length; i++) {
				EventBean b = newEvents[i];
				System.out.println(" - underlying : " + b.getUnderlying());
				System.out.println(" - type : " + b.getEventType().getName());

			}
		}

		if (oldEvents != null) {
			System.out.println("-- old events:");
			for (int i = 0; i < oldEvents.length; i++) {
				System.out.println("- " + oldEvents[i].getEventType().getName());
			}
		}

	}

}
